import Taro from "@tarojs/taro";
interface opt{
    url:string,
    data?:{[propKey:string]:any},
    header?:{[propKey:string]:any},
    success:(res:any)=>any
}
const interceptor = function (chain) {
    const requestParams = chain.requestParams
    const { method, data, url } = requestParams
  
    console.log(`http ${method || 'GET'} --> ${url} data: `, data)
  
    return chain.proceed(requestParams)
      .then(res => {
        // console.log(`http <-- ${url} result:`, res)
        return res
      })
    }

Taro.addInterceptor(interceptor);

// Taro.addInterceptor(Taro.interceptors.logInterceptor)

// Taro.addInterceptor(Taro.interceptors.timeoutInterceptor)

